<!DOCTYPE html>



  


<html class="theme-next gemini use-motion" lang="zh-Hans">
<head><meta name="generator" content="Hexo 3.8.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">
















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css">







<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">

<link href="/css/main.css?v=5.1.4" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="JavaScript,面向对象,继承,日常,">










<meta name="description" content="一、 构造继承(经典继承) 基本思想：用call() 或apply() 将父类的构造函数引入子类函数  demo   123456789101112131415161718//父类function Person(name)&amp;#123;    this.name=name;    this.sum=function()&amp;#123;        alert(this.name)    &amp;#125;&amp;">
<meta name="keywords" content="JavaScript,面向对象,继承,日常">
<meta property="og:type" content="article">
<meta property="og:title" content="JavaScript中的继承">
<meta property="og:url" content="https://blog.emx6.com/2019/08/23/JavaScript中的继承/index.html">
<meta property="og:site_name" content="上帝不会掷骰子">
<meta property="og:description" content="一、 构造继承(经典继承) 基本思想：用call() 或apply() 将父类的构造函数引入子类函数  demo   123456789101112131415161718//父类function Person(name)&amp;#123;    this.name=name;    this.sum=function()&amp;#123;        alert(this.name)    &amp;#125;&amp;">
<meta property="og:locale" content="zh-Hans">
<meta property="og:updated_time" content="2019-09-07T14:59:24.541Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="JavaScript中的继承">
<meta name="twitter:description" content="一、 构造继承(经典继承) 基本思想：用call() 或apply() 将父类的构造函数引入子类函数  demo   123456789101112131415161718//父类function Person(name)&amp;#123;    this.name=name;    this.sum=function()&amp;#123;        alert(this.name)    &amp;#125;&amp;">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Gemini',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://blog.emx6.com/2019/08/23/JavaScript中的继承/">





  <title>JavaScript中的继承 | 上帝不会掷骰子</title>
  








</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">上帝不会掷骰子</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br>
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br>
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br>
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br>
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-schedule">
          <a href="/schedule/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-calendar"></i> <br>
            
            日程表
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://blog.emx6.com/2019/08/23/JavaScript中的继承/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Glyn Yu">
      <meta itemprop="description" content>
      <meta itemprop="image" content="/images/avatar.gif">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="上帝不会掷骰子">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">JavaScript中的继承</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2019-08-23T20:41:43+08:00">
                2019-08-23
              </time>
            

            

            
          </span>

          
            <span class="post-category">
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/JavaScript/" itemprop="url" rel="index">
                    <span itemprop="name">JavaScript</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
              <span class="post-comments-count">
              <span class="post-meta-divider">|</span>
              <span class="post-meta-item-icon">
                <i class="fa fa-comment-o"></i>
              </span>
              
                <a href="/2019/08/23/JavaScript中的继承/#SOHUCS" itemprop="discussionUrl">
                  <span id="changyan_count_unit" class="post-comments-count hc-comment-count" data-xid="2019/08/23/JavaScript中的继承/" itemprop="commentsCount"></span>
                </a>
              
            
          

          
          

          
            <span class="post-meta-divider">|</span>
            <span class="page-pv"><i class="fa fa-file-o"></i>
            <span class="busuanzi-value" id="busuanzi_value_page_pv"></span>
            </span>
          

          

          

        </span></div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h3 id="一、-构造继承-经典继承"><a href="#一、-构造继承-经典继承" class="headerlink" title="一、 构造继承(经典继承)"></a>一、 构造继承(经典继承)</h3><ul>
<li><p>基本思想：用call() 或apply() 将父类的构造函数引入子类函数</p>
</li>
<li><p>demo</p>
  <figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//父类</span></span><br><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">Person</span>(<span class="params">name</span>)</span>&#123;</span><br><span class="line">    <span class="keyword">this</span>.name=name;</span><br><span class="line">    <span class="keyword">this</span>.sum=<span class="function"><span class="keyword">function</span>(<span class="params"></span>)</span>&#123;</span><br><span class="line">        alert(<span class="keyword">this</span>.name)</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line">Person.prototype.age=<span class="number">10</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">//利用构造函数继承</span></span><br><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">Con</span>(<span class="params"></span>)</span>&#123;</span><br><span class="line">    Person.call(<span class="keyword">this</span>,<span class="string">'jer'</span>)</span><br><span class="line">    <span class="keyword">this</span>.age=<span class="number">12</span>;</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">var</span> con1=<span class="keyword">new</span> Con();</span><br><span class="line"><span class="built_in">console</span>.log(con1.name);<span class="comment">//'jer'</span></span><br><span class="line"><span class="built_in">console</span>.log(con1.age);<span class="comment">//12</span></span><br><span class="line"><span class="built_in">console</span>.log(con1 <span class="keyword">instanceof</span> Person);<span class="comment">//false</span></span><br></pre></td></tr></table></figure>
</li>
<li><p>特点  </p>
<ol>
<li><strong>只继承了父类构造函数的属性，没有继承分类原型的属性</strong></li>
<li>每个新实例都有父类构造函数的副本</li>
<li>可以在 Child 中向 Parent 传参</li>
</ol>
</li>
</ul>
<h3 id="二、原型链继承"><a href="#二、原型链继承" class="headerlink" title="二、原型链继承"></a>二、原型链继承</h3><ul>
<li><p>基本思想：让新实例的原型等于父类的实例,即 <figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line">- demo  </span><br><span class="line"></span><br><span class="line">    ```JavaScript</span><br><span class="line">    //父类</span><br><span class="line">    function Person(name)&#123;</span><br><span class="line">        this.name=name;</span><br><span class="line">        this.sum=function()&#123;</span><br><span class="line">            alert(this.name)</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">    Person.prototype.age=10</span><br><span class="line"></span><br><span class="line">    //原型链继承</span><br><span class="line">    function Per()&#123;</span><br><span class="line">        this.name=&apos;ker&apos;;</span><br><span class="line">    &#125;</span><br><span class="line">    Per.prototype=new Person();</span><br><span class="line">    var per1=new Per();</span><br><span class="line">    console.log(per1.age) //10</span><br><span class="line">    console.log(per1 instanceof Person) //true</span><br></pre></td></tr></table></figure></p>
</li>
<li><p>特点  </p>
<ol>
<li>可继承父类构造函数的属性，父类原型的属性</li>
<li>所有新实例都会共享父类实例的属性。（原型上的属性是共享的，一个实例修改了原型属性，另一个实例的原型属性也会被修改！）</li>
</ol>
</li>
</ul>
<h3 id="三、组合继承（组合原型链继承和借用构造函数继承）"><a href="#三、组合继承（组合原型链继承和借用构造函数继承）" class="headerlink" title="三、组合继承（组合原型链继承和借用构造函数继承）"></a>三、组合继承（组合原型链继承和借用构造函数继承）</h3><ul>
<li><p>基本思想：上述两种结合  </p>
</li>
<li><p>demo  </p>
  <figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">Person</span>(<span class="params">name</span>)</span>&#123;</span><br><span class="line">    <span class="keyword">this</span>.name=name;</span><br><span class="line">    <span class="keyword">this</span>.sum=<span class="function"><span class="keyword">function</span>(<span class="params"></span>)</span>&#123;</span><br><span class="line">        alert(<span class="keyword">this</span>.name)</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line">Person.prototype.age=<span class="number">10</span></span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">SubType</span>(<span class="params">name</span>)</span>&#123;</span><br><span class="line">    Person.call(<span class="keyword">this</span>,name)</span><br><span class="line">&#125;</span><br><span class="line">SubType.prototype=<span class="keyword">new</span> Person();</span><br><span class="line"><span class="keyword">var</span> sub=<span class="keyword">new</span> SubType(<span class="string">'gar'</span>);</span><br><span class="line"><span class="built_in">console</span>.log(sub.name) <span class="comment">//'gar'</span></span><br><span class="line"><span class="built_in">console</span>.log(sub.age)<span class="comment">// 10</span></span><br></pre></td></tr></table></figure>

</li>
</ul>
<h3 id="四、原型式继承"><a href="#四、原型式继承" class="headerlink" title="四、原型式继承"></a>四、原型式继承</h3><ul>
<li><p>基本思想：利用构造函数的原型对象实现继承,用一个函数包装一个对象，然后返回这个函数的调用</p>
</li>
<li><p>demo</p>
  <figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">content</span>(<span class="params">obj</span>)</span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">function</span> <span class="title">F</span>(<span class="params"></span>)</span>&#123;&#125;</span><br><span class="line">    F.prototype=obj</span><br><span class="line">    <span class="keyword">return</span> <span class="keyword">new</span> F()</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">var</span> sup=<span class="keyword">new</span> Person()</span><br><span class="line"><span class="keyword">var</span> sup1=content(sup)</span><br><span class="line"><span class="built_in">console</span>.log(sup1.age) <span class="comment">//10</span></span><br></pre></td></tr></table></figure>

</li>
</ul>
<h3 id="五、寄生式继承"><a href="#五、寄生式继承" class="headerlink" title="五、寄生式继承"></a>五、寄生式继承</h3><ul>
<li><p>基本思想：与原型式继承类似</p>
</li>
<li><p>demo  </p>
<pre><code class="JavaScript"><span class="function"><span class="keyword">function</span> <span class="title">content</span>(<span class="params">obj</span>)</span>{
    <span class="function"><span class="keyword">function</span> <span class="title">F</span>(<span class="params"></span>)</span>{}
    F.prototype=obj
    <span class="keyword">return</span> <span class="keyword">new</span> F()
}
<span class="keyword">var</span> sup=<span class="keyword">new</span> Person()

<span class="function"><span class="keyword">function</span> <span class="title">subObject</span>(<span class="params">obj</span>)</span>{
    <span class="keyword">var</span> sub=content(obj)
    sub.name=<span class="string">'gar'</span>;
    <span class="keyword">return</span> sub;
}

<span class="keyword">var</span> sup2=subobject(sup);
<span class="built_in">console</span>.log(<span class="keyword">typeof</span> subobject);
<span class="built_in">console</span>.log(<span class="keyword">typeof</span> sup2)
<span class="built_in">console</span>.log(sup2.name)
</code></pre>
</li>
</ul>
<h3 id="六、寄生组合式继承"><a href="#六、寄生组合式继承" class="headerlink" title="六、寄生组合式继承"></a>六、寄生组合式继承</h3><ul>
<li><p>基本思想  </p>
</li>
<li><p>demo  </p>
<pre><code class="JavaScript"><span class="function"><span class="keyword">function</span> <span class="title">content</span>(<span class="params">obj</span>)</span>{
    <span class="function"><span class="keyword">function</span> <span class="title">F</span>(<span class="params"></span>)</span>{}
    F.prototype=obj
    <span class="keyword">return</span> <span class="keyword">new</span> F()
}
<span class="keyword">var</span> con=content(Person.prototype)

<span class="comment">//组合</span>
<span class="function"><span class="keyword">function</span> <span class="title">Sub</span>(<span class="params"></span>)</span>{
    Person.call(<span class="keyword">this</span>)
}

Sub.prototype=con;
con.constructor=sub;
<span class="keyword">var</span> sub1=<span class="keyword">new</span> Sub()

<span class="built_in">console</span>.log(sub1.age)<span class="comment">//10</span></code></pre>
</li>
<li><p>特点  </p>
<blockquote><p>引用《JavaScript高级程序设计》中对寄生组合式继承的夸赞就是：这种方式的高效率体现它只调用了一次Parent构造函数，并且因此避免了在 Parent.prototype 上面创建不必要的、多余的属性。与此同时，原型链还能保持不变；因此，还能够正常使用 instanceof 和 isPrototypeOf。开发人员普遍认为寄生组合式继承是引用类型最理想的继承范式。</p>
</blockquote>
</li>
</ul>

      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/JavaScript/" rel="tag"># JavaScript</a>
          
            <a href="/tags/面向对象/" rel="tag"># 面向对象</a>
          
            <a href="/tags/继承/" rel="tag"># 继承</a>
          
            <a href="/tags/日常/" rel="tag"># 日常</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2019/08/21/20190821-技术之瞳/" rel="next" title="20190821-技术之瞳-读书笔记">
                <i class="fa fa-chevron-left"></i> 20190821-技术之瞳-读书笔记
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2019/08/28/js中函数参数值传递和引用传递的学习/" rel="prev" title="js中函数参数值传递和引用传递的学习">
                js中函数参数值传递和引用传递的学习 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  
    <div class="comments" id="comments">
      <div id="SOHUCS"></div>
    </div>

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <p class="site-author-name" itemprop="name">Glyn Yu</p>
              <p class="site-description motion-element" itemprop="description"></p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/archives/">
              
                  <span class="site-state-item-count">26</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                <a href="/categories/index.html">
                  <span class="site-state-item-count">8</span>
                  <span class="site-state-item-name">分类</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                <a href="/tags/index.html">
                  <span class="site-state-item-count">48</span>
                  <span class="site-state-item-name">标签</span>
                </a>
              </div>
            

          </nav>

          

          
            <div class="links-of-author motion-element">
                
                  <span class="links-of-author-item">
                    <a href="https://github.com/zjycp" target="_blank" title="GitHub">
                      
                        <i class="fa fa-fw fa-github"></i>GitHub</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="mailto:chnzjycp@foxmail.com" target="_blank" title="E-Mail">
                      
                        <i class="fa fa-fw fa-envelope"></i>E-Mail</a>
                  </span>
                
            </div>
          

          
          

          
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#一、-构造继承-经典继承"><span class="nav-number">1.</span> <span class="nav-text">一、 构造继承(经典继承)</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#二、原型链继承"><span class="nav-number">2.</span> <span class="nav-text">二、原型链继承</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#三、组合继承（组合原型链继承和借用构造函数继承）"><span class="nav-number">3.</span> <span class="nav-text">三、组合继承（组合原型链继承和借用构造函数继承）</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#四、原型式继承"><span class="nav-number">4.</span> <span class="nav-text">四、原型式继承</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#五、寄生式继承"><span class="nav-number">5.</span> <span class="nav-text">五、寄生式继承</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#六、寄生组合式继承"><span class="nav-number">6.</span> <span class="nav-text">六、寄生组合式继承</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2019</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Glyn Yu</span>

  
</div>









        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>

  
    <span class="site-uv">
      <i class="fa fa-user"></i>
      <span class="busuanzi-value" id="busuanzi_value_site_uv"></span>
      
    </span>
  

  
    <span class="site-pv">
      <i class="fa fa-eye"></i>
      <span class="busuanzi-value" id="busuanzi_value_site_pv"></span>
      
    </span>
  
</div>








  <div style="display: none;">
    <script src="//s95.cnzz.com/z_stat.php?id=1277767124&web_id=1277767124" language="JavaScript"></script>
  </div>



        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.4"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.4"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  




  
    <script type="text/javascript">
    (function(){
      var appid = 'cyuiUNe9o';
      var conf = '7ce07412b2706ea50ada6a787faf513f';
      var width = window.innerWidth || document.documentElement.clientWidth;
      if (width < 960) {
      window.document.write('<script id="changyan_mobile_js" charset="utf-8" type="text/javascript" src="https://changyan.sohu.com/upload/mobile/wap-js/changyan_mobile.js?client_id=' + appid + '&conf=' + conf + '"><\/script>'); } else { var loadJs=function(d,a){var c=document.getElementsByTagName("head")[0]||document.head||document.documentElement;var b=document.createElement("script");b.setAttribute("type","text/javascript");b.setAttribute("charset","UTF-8");b.setAttribute("src",d);if(typeof a==="function"){if(window.attachEvent){b.onreadystatechange=function(){var e=b.readyState;if(e==="loaded"||e==="complete"){b.onreadystatechange=null;a()}}}else{b.onload=a}}c.appendChild(b)};loadJs("https://changyan.sohu.com/upload/changyan.js",function(){
        window.changyan.api.config({appid:appid,conf:conf})});
      }
    })();
    </script>
    <script type="text/javascript" src="https://assets.changyan.sohu.com/upload/plugins/plugins.count.js"></script>
  









  





  

  

  

  
  

  

  

  

</body>
</html>
